//
//  ZTimeOutOrderVC.m
//  DistributorAB
//
//  Created by LZY on 2019/10/16.
//  Copyright © 2019 主事丫环. All rights reserved.
//

#import "ZTimeOutOrderVC.h"
#import "ZTimeOutOrderChildVC.h"
#import "SGPagingView.h"

@interface ZTimeOutOrderVC () <SGPageTitleViewDelegate,SGPageContentScrollViewDelegate>
@property (nonatomic, strong) SGPageTitleView *pageTitleView;
@property (nonatomic, strong) SGPageContentScrollView *pageContentScrollView;

@end

@implementation ZTimeOutOrderVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"超时未接单";
    [self.leftbutton setImage:imgname(@"left_icon") forState:(UIControlStateNormal)];
    self.view.backgroundColor = kColorWithHex(0xf2f2f2);
    
    [self setupViewAction];
}

#pragma mark - 界面布局
- (void)setupViewAction{
    SGPageTitleViewConfigure *configure = [SGPageTitleViewConfigure pageTitleViewConfigure];
    configure.indicatorAdditionalWidth = 10; // 说明：指示器额外增加的宽度，不设置，指示器宽度为标题文字宽度；若设置无限大，则指示器宽度为按钮宽度
    configure.titleGradientEffect = YES;
    
    configure.titleSelectedColor= [UIColor colorWithHexString:@"#70BE68"];
    configure.titleColor= [UIColor colorWithHexString:@"#666666"];
    configure.showIndicator = YES;
    configure.indicatorColor = kColorWithHex(0x70be68);
    configure.bottomSeparatorColor= [UIColor whiteColor];
    
    NSArray *titleArr = @[@"全部",@"未处理",@"处理中",@"已处理"];
    
    NSMutableArray *childVCS = [NSMutableArray array];
    ZTimeOutOrderChildVC *vcOne = [ZTimeOutOrderChildVC new];
    vcOne.type = ZTimeOutOrderChildVCTypeAll;
    [childVCS addObject:vcOne];
    
    ZTimeOutOrderChildVC *vcTwo = [ZTimeOutOrderChildVC new];
    vcTwo.type = ZTimeOutOrderChildVCTypeUntreated;
    [childVCS addObject:vcTwo];
    
    ZTimeOutOrderChildVC *vcThree = [ZTimeOutOrderChildVC new];
    vcThree.type = ZTimeOutOrderChildVCTypeTreating;
    [childVCS addObject:vcThree];
    
    ZTimeOutOrderChildVC *vcFour = [ZTimeOutOrderChildVC new];
    vcFour.type = ZTimeOutOrderChildVCTypeTreated;
    [childVCS addObject:vcFour];
    
    self.pageTitleView = [SGPageTitleView pageTitleViewWithFrame:CGRectMake(0, kNaviHeight, kScreen_Width, 45) delegate:self titleNames:titleArr configure:configure];
    self.pageContentScrollView = [[SGPageContentScrollView alloc] initWithFrame:CGRectMake(0, kNaviHeight + 45, KWIDTH, KHEIGHT - kNaviHeight - 45) parentVC:self childVCs:childVCS];
    
    _pageContentScrollView.delegatePageContentScrollView = self;
    [self.view addSubview:self.pageTitleView ];
    
    [self.view addSubview:_pageContentScrollView];
}
#pragma mark - SGPageTitleViewDelegate
//联动 pageContent 的方法
- (void)pageTitleView:(SGPageTitleView *)pageTitleView selectedIndex:(NSInteger)selectedIndex{
    [self.pageContentScrollView setPageContentScrollViewCurrentIndex:selectedIndex];
}
#pragma mark - SGPageContentScrollViewDelegate
//联动 SGPageTitleView 的方法
- (void)pageContentScrollView:(SGPageContentScrollView *)pageContentScrollView progress:(CGFloat)progress originalIndex:(NSInteger)originalIndex targetIndex:(NSInteger)targetIndex{
    [self.pageTitleView setPageTitleViewWithProgress:progress originalIndex:originalIndex targetIndex:targetIndex];
}
//获取 SGPageContentScrollView 当前子控制器的下标值
- (void)pageContentScrollView:(SGPageContentScrollView *)pageContentScrollView index:(NSInteger)index{
    
}
/** SGPageContentScrollView 内容开始拖拽方法 */
- (void)pageContentScrollViewWillBeginDragging{
    
}
/** SGPageContentScrollView 内容结束拖拽方法 */
- (void)pageContentScrollViewDidEndDecelerating{
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
